# coding=utf-8

import web
from controllers.admin.hooks import load_hook, unload_hook

__all__ = ('app_admin', )

urls = (
    # 首页
    '[/]*', 'controllers.admin.views.index',
    # Home
    '/home', 'controllers.admin.views.home',
    # 登录
    '/login', 'controllers.admin.views.login',
    # 退出登录
    '/logout', 'controllers.admin.views.logout',

    # ====== 酒店 ======
    '/hotel', 'controllers.admin.hotels.views.Index',

    # ====== 蜘蛛 ======
    # 蜘蛛
    '/spider', 'controllers.admin.spider.views.SpiderIndex',
    '/spider/edit/(\d+)', 'controllers.admin.spider.views.SpiderIndex',
    # 酒店
    '/spider/hotel', 'controllers.admin.spider.views.HotelIndex',
    '/spider/hotel/add', 'controllers.admin.spider.views.HotelAdd',
    '/spider/hotel/edit/(\d+)', 'controllers.admin.spider.views.HotelAdd',

    # ====== 媒体 ======
    '/media/upload', 'controllers.admin.media.MediaUpload',
    '/media/async-upload', 'controllers.admin.media.MediaAsyncUpload',
    '/media/library', 'controllers.admin.media.MediaLibrary',
    '/media/delete/(\d+)', 'controllers.admin.media.MediaDelete',
    '/media/rebuild', 'controllers.admin.media.MediaRebuild',

    # ====== 线路 ======
    # Top10 推荐
    '/tours/top10', 'controllers.admin.tours.views.Top10',
    # 特惠信息
    # 列表
    '/discount', 'controllers.admin.discounts.views.Index',
    # 添加
    '/discount/add', 'controllers.admin.discounts.views.Add',
    # 编辑
    '/discount/edit/(\d+)', 'controllers.admin.discounts.views.Add',
    # 删除
    '/discount/delete/(\d+)', 'controllers.admin.discounts.views.Delete',
    # 甄选TOP10
    # 列表及添加
    '/discount/top10', 'controllers.admin.discounts.views.Top10',
    # 编辑
    '/discount/top10/edit/(\d+)', 'controllers.admin.discounts.views.Top10',
    # 发送 Top10 订阅邮件
    '/discount/top10/dispatch', 'controllers.admin.discounts.views.DispatchTop10Mails',

    # ====== 灵感 ======
    # 灵感管理
    '/afflatus', 'controllers.admin.afflatus.views.Index',
    # 添加灵感
    '/afflatus/add', 'controllers.admin.afflatus.views.Add',
    # 修改灵感
    '/afflatus/edit/(\d+)', 'controllers.admin.afflatus.views.Add',
    # 删除灵感
    '/afflatus/delete/(\d+)', 'controllers.admin.afflatus.views.Delete',

    # ====== 项目 ======
    # 目的地管理
    '/dest', 'controllers.admin.projects.views.DestinationIndex',
    '/dest/edit/(\d+)', 'controllers.admin.projects.views.DestinationIndex',
    # 标签管理
    '/tags', 'controllers.admin.projects.views.TagsIndex',
    '/tags/edit/(\d+)', 'controllers.admin.projects.views.TagsIndex',
    # 项目管理
    '/proj', 'controllers.admin.projects.views.ProjectIndex',
    '/proj/edit/(\d+)', 'controllers.admin.projects.views.ProjectIndex',

    # ====== 合作方 ======
    # 合作方管理
    '/partner', 'controllers.admin.partners.views.Index',
    '/partner/add', 'controllers.admin.partners.views.Add',
    '/partner/edit/(\d+)', 'controllers.admin.partners.views.Add',

    # ====== 管理员 ======
    # 管理员管理
    # 管理员添加
)

app_admin = web.application(urls, locals())

# processor
app_admin.add_processor( web.loadhook(load_hook) )
app_admin.add_processor( web.unloadhook(unload_hook) )
